<div class="pl-3 pr-3 bg-white">
    <h4>企业详情</h4>
    <ts-tabs [tabs]="['新增企业','企业权限']" [color]="global.params.color" [target]="tsTabs" activeTab="新增企业">
    </ts-tabs>
</div>
<ts-datepicker #datepickerThree="tsDatepicker" [(ngModel)]="goods.maxUserNumberTime" [color]="global.params.color" name="couponName"></ts-datepicker>
<ts-datepicker #datepickerone="tsDatepicker" [(ngModel)]="goods.maxSpaceNumberTime" [color]="global.params.color" name="couponName"></ts-datepicker>
<ts-datepicker #datepickeradd="tsDatepicker" [(ngModel)]="goods.maxCustomerNumberTime" [color]="global.params.color" name="couponName"></ts-datepicker>
<div class="p-2">
    <div #tsTabs='tsTabs' tsTabs class="card">
        <div class="card-body">
            <div tsTab tab='新增企业'>
                <div class="card-body">
                    <div class="container m-0">
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">企业名称</label>
                            <div class="col-sm-10">
                                <input [(ngModel)]="goods.enterpriseName" type="text" class="form-control" placeholder="请输入企业的名称">
                                <div class="invalid-feedback">企业名称是必填的</div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">所在区域</label>
                            <div class="col-sm-10">
                                <select [(ngModel)]="goods.areaId" class="custom-select" placeholder="请选择企业类型">
                                    <option *ngFor="let type of aradid" [ngValue]="type.id">{{type.areaName}}</option>
                                </select>
                            </div>
                        </div>
                        <!-- <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">所在区域</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col">
                                        <select [(ngModel)]="goods.goodsParentType" class="custom-select" placeholder="请选择一级分类">
                                                <option *ngFor="let type of parentTypes" [ngValue]="type.value">{{type.text}}</option>
                                            </select>
                                    </div>
                                    <div class="col">
                                        <select [(ngModel)]="goods.goodsType" class="custom-select" placeholder="请选择二级分类">
                                                <option *ngFor="let type of getChildTypes" [ngValue]="type.value">{{type.text}}</option>
                                            </select>
                                    </div>
                                </div>
                            </div>
                        </div> -->
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">管理员</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.managerName" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">联系电话</label>
                                    <div class="col-sm-9">
                                        <input [(ngModel)]="goods.mobile" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">最大用户数</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.maxUserNumber" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">使用时间</label>
                                    <div class="col-sm-9">
                                        <!-- <input [(ngModel)]="goods.maxCustomerNumberTime" type="text" class="form-control"> -->
                                        <input tsToggle [target]="datepickerThree" [bind]="datepickerThree" [value]="goods.maxUserNumberTime " placeholder="请选择日期"
                                            type="text" class="form-control ht bg-white pointer required">
                                    </div>
                                </div>
                            </div>
                            <!-- <div class="form-group row">
                                    <label class="col-sm-2 col-form-label label-required text-right" style="padding-right: 0px;">期初日期</label>
                                <div class="col-sm-4">
                                <input tsToggle [target]="datepickerThree" [bind]="datepickerThree"
                                [value]="inventory.beginOfPeriodDate "placeholder="请选择日期" type="text"  class="form-control ht bg-white pointer required" >
                                </div>
                                </div> -->
                        </div>
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">最大空间量</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.maxSpaceNumber" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">使用时间</label>
                                    <div class="col-sm-9">
                                        <!-- <input [(ngModel)]="goods.maxSpaceNumberTime" type="text" class="form-control"> -->
                                        <input tsToggle [target]="datepickerone" [bind]="datepickerone" [value]="goods.maxSpaceNumberTime " placeholder="请选择日期" type="text"
                                            class="form-control ht bg-white pointer required">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">最大客户数</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.maxCustomerNumber" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">使用时间</label>
                                    <div class="col-sm-9">

                                        <input tsToggle [target]="datepickeradd" [bind]="datepickeradd" [value]="goods.maxCustomerNumberTime " placeholder="请选择日期"
                                            type="text" class="form-control ht bg-white pointer required">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">业务负责人</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.head" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">业务推荐人</label>
                                    <div class="col-sm-9">
                                        <input [(ngModel)]="goods.referees" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col">
                                <div class="form-group row">
                                    <label class="col-sm-4 col-form-label text-right">服务机构</label>
                                    <div class="col-sm-8">
                                        <input [(ngModel)]="goods.serviceAgencies" type="text" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="col-sm-5">
                                <div class="form-group row">
                                    <label class="col-sm-3 col-form-label text-center">企业类型</label>
                                    <div class="col-sm-9">
                                        <select [(ngModel)]="goods.enterpriseTypeId" class="custom-select" placeholder="请选择企业类型">
                                            <option *ngFor="let type of citid" [ngValue]="type.id">{{type.typeName}}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                                <div class="col">
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">账号</label>
                                        <div class="col-sm-8">
                                            <input [(ngModel)]="goods.account" type="text" class="form-control">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-1"></div>
                                <div class="col-sm-5">
                                    <div class="form-group row">
                                        <label class="col-sm-3 col-form-label text-center">密码</label>
                                        <div class="col-sm-9">
                                            <input [(ngModel)]="goods.password" type="text" class="form-control">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">是否启用账号</label>
                            <div class="col-sm-10 pt-2">
                                <ts-switch [color]="global.params.color" [values]="{open:1,close:0}" [(ngModel)]="goods.status"></ts-switch>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">选择模块</label>
                            <div class="col-sm-10 pt-2">
                                <ts-checkbox class="mr-5" *ngFor="let sel of selectModules;index as i" color="secondary" [value]="i+1" [(ngModel)]="goods.managerId">{{sel.name}}</ts-checkbox>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="card-body">
                    <div class="container m-0">
                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label label-required text-right">企业合同</label>
                            <div class="col-sm-10">
                                <ts-image-cards #tsUp [(src)]="goods.contractAttachment" [config]="options" title="点击选择"></ts-image-cards>
                            </div>
                        </div>
                        <!-- <div class="form-group row">
                                <label class="col-sm-2 col-form-label label-required text-right">企业展示图</label>
                                <div class="col-sm-10">
                                    <ts-image-cards [(src)]="goods.goodsImages" [config]="options" title="点击选择"></ts-image-cards>
                                </div>
                            </div> -->
                    </div>
                </div>
                <!-- <div class="border-bottom">
                    <div class="card-body">
                        <div class="container m-0">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label label-required text-right">企业详情</label>
                                <div class="col-sm-10">
                                    <textarea [(ngModel)]="goods.goodsDetail" class="form-control"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> -->
                <div class="mt-2 m-btn">
                    <button routerLink="/manage/account" tsBtn color="white">返回列表</button>
                    <button *ngIf="goods.id===0" tsBtn loading color="success" (submit)="confirmInsert($event)">确认添加</button>
                    <!-- <button tsBtn color="warning" (click)="resetForm()">添加新企业</button> -->
                    <button *ngIf="goods.id>0" tsBtn loading color="primary" (submit)="confirmUpdate($event)">确认修改</button>
                </div>
            </div>
            <!-- <div tsTab tab='企业权限'>
                <div class="border-bottom pb-2">
                    <div class="card-header pl-0 pt-0">规格类型</div>
                    <div class="mt-2" *ngFor="let goodsSpecification of goodsSpecifications;index as i">
                        <div class="input-group">
                            <input [(ngModel)]="goodsSpecification.specificationTitle" type="text" class="form-control" placeholder="请输入规格分类名称:颜色">
                            <div class="input-group-append">
                                <button (click)="addSpecificationChild(goodsSpecification)" class="btn btn-success" type="button">添加规格名称</button>
                                <button (click)="removeSpecification(i)" class="btn btn-danger" type="button">删除本规格</button>
                            </div>
                        </div>
                        <div class="mt-2 form-inline">
                            <div class="input-group mb-2 mr-2" *ngFor="let specificationName of goodsSpecification.specificationNames;index as j;trackBy trackFunc">
                                <div class="input-group-prepend">
                                    <button class="btn btn-white" type="button">{{j+1}}</button>
                                </div>
                                <input [(ngModel)]="goodsSpecification.specificationNames[j]" type="text" class="form-control">
                                <div class="input-group-append">
                                    <button (click)="removeSpecificationChild(goodsSpecification,j)" class="btn btn-white" type="button">
                                        <i class="iconfont icon-delete"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="mt-2">
                        <button (click)="addSpecification()" tsBtn color="success">新增规格分类</button>
                    </div>
                </div>
                <div class="card-header pl-0">规格明细</div>
                <table class="table table-sm table-bordered text-center">
                    <thead>
                        <tr>
                            <th *ngFor="let goodsSpecification of goodsSpecifications">{{goodsSpecification.specificationTitle}}</th>
                            <th *ngFor="let th of defaultTh">{{th}}</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let tr of getSpecificationTr()">
                            <td *ngFor="let td of getSpecificationTd(tr)" [attr.rowspan]="td.rowspan">{{td.name}}</td>
                            <td>
                                <input [(ngModel)]="goodsSpecificationDetails[tr].goodsPrice" class="form-control" type="text">
                            </td>
                            <td>
                                <input [(ngModel)]="goodsSpecificationDetails[tr].goodsStocks" class="form-control" type="text">
                            </td>
                            <td>
                                <ts-switch [color]="global.params.color" [values]="{open:1,close:0}" [(ngModel)]="goodsSpecificationDetails[tr].isActive"></ts-switch>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div class="mt-2 m-btn">
                    <button routerLink="/store/goods" tsBtn color="white">返回列表</button>
                    <button tsBtn loading color="primary" (submit)="confirmSave($event)">保存规格</button>
                </div>
            </div> -->
        </div>
    </div>
</div>